﻿using Rectangle;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;


namespace Rectangle
{
    
    
    /// <summary>
    ///This is a test class for RectangleTest and is intended
    ///to contain all RectangleTest Unit Tests
    ///</summary>
    [TestClass()]
    public class RectangleTest
    {

        [TestMethod()]
        public void RectangleConstructorTest()
        {
            double posX = 0F; 
            double posY = 0F;
            double width = 2F;
            double height = 3F; 
            Rectangle target = new Rectangle(posX, posY, width, height);
        }

        [TestMethod()]
        [ExpectedException(typeof(ArgumentException))]
        public void RectangleConstructorTestWidthLessThanZero()
        {
            double posX = 0F;
            double posY = 0F;
            double width = -5.0F;
            double height = 3F;
            Rectangle target = new Rectangle(posX, posY, width, height);
        }

        [TestMethod()]
        [ExpectedException(typeof(ArgumentException))]
        public void RectangleConstructorTestHeightLessThanZero()
        {
            double posX = 0F;
            double posY = 0F;
            double width = 1.0F;
            double height = -3F;
            Rectangle target = new Rectangle(posX, posY, width, height);
        }

        [TestMethod()]
        [DeploymentItem("Rectangle.exe")]
        public void AreaTest()
        {

            Rectangle_Accessor target = new Rectangle_Accessor(0, 12.2, 5, 10);
            double expected = 50F;
            double actual;
            actual = target.Area();
            Assert.AreEqual(expected, actual);
        }

        [TestMethod()]
        public void CloneTest()
        {
            double posX = 3F;
            double posY = 5F; 
            double width = 18F;
            double height = 10F;
            Rectangle target = new Rectangle(posX, posY, width, height); //
            object expected = new Rectangle(posX, posY, width, height);
            object actual;
            actual = target.Clone();
            Assert.AreEqual(expected, actual);
        }

        [TestMethod()]
        public void CompareToTestFirstGreaterThanSecond()
        {
            Rectangle target = new Rectangle(5 , 8 , 140 , 20); 
            Rectangle other = new Rectangle(3, 5, 20, 30);
            int expected =1 ; // TODO: Initialize to an appropriate value
            int actual;
            actual = target.CompareTo(other);
            Assert.AreEqual(expected, actual);
        }

        [TestMethod()]
        public void CompareToTestFirstLesserThanSecond()
        {
            Rectangle target = new Rectangle(5, 8, 14, 2);
            Rectangle other = new Rectangle(3, 5, 20, 30);
            int expected = -1; // TODO: Initialize to an appropriate value
            int actual;
            actual = target.CompareTo(other);
            Assert.AreEqual(expected, actual);
        }

        [TestMethod()]
        public void CompareToTestFirstEqualToSecond()
        {
            Rectangle target = new Rectangle(5, 8, 14, 2);
            Rectangle other = new Rectangle(3, 5, 14, 2);
            int expected = 0;
            int actual;
            actual = target.CompareTo(other);
            Assert.AreEqual(expected, actual);
        }


        [TestMethod()]
        public void HeightTest()
        {
            double posX = 0F;
            double posY = 0F; 
            double width = 0F; 
            double height = 200F; 
            Rectangle target = new Rectangle(posX, posY, width, height);
            double expected = 200F;
            double actual;
            target.Height = expected;
            actual = target.Height;
            Assert.AreEqual(expected, actual);

        }

        [TestMethod()]
        public void PosXTest()
        {
            double posX = 230F;
            double posY = 0F;
            double width = 0F;
            double height = 0F; 
            Rectangle target = new Rectangle(posX, posY, width, height); 
            double expected = 230F; 
            double actual;
            target.PosX = expected;
            actual = target.PosX;
            Assert.AreEqual(expected, actual);
        }

        /// <summary>
        ///A test for PosY
        ///</summary>
        [TestMethod()]
        public void PosYTest()
        {
            double posX = 30F;
            double posY = 0F; 
            double width = 0F; // TODO: Initialize to an appropriate value
            double height = 0F; // TODO: Initialize to an appropriate value
            Rectangle target = new Rectangle(posX, posY, width, height); // TODO: Initialize to an appropriate value
            double expected = 30F; // TODO: Initialize to an appropriate value
            double actual;
            target.PosY = expected;
            actual = target.PosY;
            Assert.AreEqual(expected, actual);
        }

        /// <summary>
        ///A test for Width
        ///</summary>
        [TestMethod()]
        public void WidthTest()
        {
            double posX = 0F; // TODO: Initialize to an appropriate value
            double posY = 0F; // TODO: Initialize to an appropriate value
            double width = 230F; // TODO: Initialize to an appropriate value
            double height = 0F; // TODO: Initialize to an appropriate value
            Rectangle target = new Rectangle(posX, posY, width, height); // TODO: Initialize to an appropriate value
            double expected = 230F; // TODO: Initialize to an appropriate value
            double actual;
            target.Width = expected;
            actual = target.Width;
            Assert.AreEqual(expected, actual);
        }
    }
}
